import { Component } from 'react';
import './Header.css'
class Header extends Component {
  render() {
    return (
      <div className="Header">
          <header>
              <span>ToDoList</span>
              <input placeholder="添加todo" onKeyUp={
                  (e) => {
                      if(e.keyCode === 13) {
                        this.props.fn(
                            {
                                name: e.target.value,
                                status: "pending"
                        })
                        e.target.value = ''
                      }
                     
                  }
              }/>
          </header>
      </div>
    );
  }
}
export default Header;